const tt = window['tt'];
import GlobalData from "./Data/GlobalData";
import GravityEngine from "./Gravitational/gravityengine.mg.cocoscreator.min";

class TTHSDK {
    VideoAD;
    Inters;

    Init() {
        console.log(' Hyd sdk init');
        return
        
    }

    Login() {
     
    }

    Request() {
       
    }

    GetLaunchOptionsSync() {
        
    }

    PostClickId(event_type) {
       
    }

    ShowVideo() {

        this.VideoAD = tt.createRewardedVideoAd({adUnitId: '废物接口'});
        this.VideoAD.onClose((res) => {
            console.log(' video on close ', res);
            if (res.isEnded) {

            } else {

            }
            if (res.count) {

            }

            this.VideoAD.destroy().then().catch((err) => {
                console.error(' video destroy err', err);
            });
        });
        this.VideoAD.onError((res) => {
            console.error(' video on err', res);
        });
        this.VideoAD.onLoad(() => {
            console.log(' video onload');
            this.VideoAD.show().then(() => {
                GlobalData.inters_bool = false;
                setTimeout(() => {
                    GlobalData.inters_bool = true;
                }, 60 * 1000);
            });
        });
        this.VideoAD.load();
    }

    ShowInters() {
       
    }

    GetRandom() {
    }

    getQuery = (url) => {

    }

}

let HydSDK = new TTHSDK();

export {HydSDK}